rendernode: Transform cairo_t to correct coordinates
authorBenjamin Otte <otte@redhat.com>
Tue, 1 Nov 2016 02:42:35 +0000 (03:42 +0100)
committerBenjamin Otte <otte@redhat.com>
Tue, 1 Nov 2016 02:42:35 +0000 (03:42 +0100)
We want to have the coordinate system of the created cairo surface to be
identical to the coordinate system of the node's bounds. For that, we
need to translate the cairo surface by the bounds' origin.

gsk/gskrendernode.c

index 85cf2466a65a8fe632cb8777b1a5958aa2368cb5..adca902deb4751d5e71f2f8098b6e791b50c3a4f 100644 (file)
@@ -1424,6 +1424,8 @@ gsk_render_node_get_draw_context (GskRenderNode *node)
 
   res = cairo_create (node->surface);
 
+  cairo_translate (res, -node->bounds.origin.x, -node->bounds.origin.y);
+
   cairo_rectangle (res,
                    node->bounds.origin.x, node->bounds.origin.y,
                    node->bounds.size.width, node->bounds.size.height);